import { pulsingBorderPresets } from '@paper-design/shaders-react';
import type { ShaderDef } from './shader-def-types';
import { animatedCommonParams } from './common-param-def';

const defaultParams = pulsingBorderPresets[0].params;

export const pulsingBorderDef: ShaderDef = {
  name: 'Pulsing Border',
  description: 'Luminous trails of color merging into a glowing gradient contour.',
  params: [
    {
      name: 'colors',
      type: 'string[]',
      defaultValue: [],
      isColor: true,
      description: 'Up to 5 colors',
    },
    {
      name: 'colorBack',
      type: 'string',
      defaultValue: defaultParams.colorBack,
      isColor: true,
      description: 'Background color',
    },
    {
      name: 'roundness',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.roundness,
      description: 'The border radius',
    },
    {
      name: 'thickness',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.thickness,
      description: 'The border base width',
    },
    {
      name: 'softness',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.softness,
      description: 'Border edge sharpness (0 = hard edge, 1 = smooth gradient)',
    },
    {
      name: 'aspectRatio',
      type: 'enum',
      defaultValue: defaultParams.aspectRatio,
      description: 'Aspect ratio of the effect',
      options: ['auto', 'square'],
    },
    {
      name: 'intensity',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.intensity,
      description: 'Thickness of individual color spots',
    },
    {
      name: 'bloom',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.bloom,
      description: 'The power of glow (0 = normal color blending, 1 = fully additive blending)',
    },
    {
      name: 'spots',
      type: 'number',
      min: 1,
      max: 20,
      step: 1,
      defaultValue: defaultParams.spots,
      description: 'Number of spots added for each color',
    },
    {
      name: 'spotSize',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.spotSize,
      description: 'Angular size of spots',
    },
    {
      name: 'pulse',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.pulse,
      description: 'Optional pulsing animation',
    },
    {
      name: 'smoke',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.smoke,
      description: 'Optional noisy shape extending the border shape',
    },
    {
      name: 'smokeSize',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.smokeSize,
      description: 'The size of the smoke effect (effective with smoke > 0)',
    },
    {
      name: 'margin',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: undefined,
      description: 'Distance from canvas edges to the effect',
    },
    {
      name: 'marginLeft',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.marginLeft,
      description: 'Distance from the left edge to the effect',
    },
    {
      name: 'marginRight',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.marginRight,
      description: 'Distance from the right edge to the effect',
    },
    {
      name: 'marginTop',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.marginTop,
      description: 'Distance from the top edge to the effect',
    },
    {
      name: 'marginBottom',
      type: 'number',
      min: 0,
      max: 1,
      defaultValue: defaultParams.marginBottom,
      description: 'Distance from the bottom edge to the effect',
    },
    ...animatedCommonParams,
  ],
};
